Page({
  data:{
    list: [
      {alphabet: 'Top'},
      {alphabet: 'A', datas: ['accommodate 容纳1']},
      {alphabet: 'B', datas: ['by and by 不久后2','be showered with praise 大获得赞誉2','break the news to 把这个消息告诉2']},
      {alphabet: 'C', datas:  ['cellar 地窖1','chop 砍伐1','cover 掩盖1','creep forward 悄悄前进2','call on 要求2']},
      {alphabet: 'D'},
      {alphabet: 'E', datas:  ['escape my throat 我不禁（不由自主）2']},
      {alphabet: 'F', datas:  ['figure 身影1','fertile 肥沃的1','fortify 加固1','fancy 认为1']},
      {alphabet: 'G', datas:  ['get my bearings 辨明方向1','gather my courage 鼓起勇气1','gave away 暴露1']},
      {alphabet: 'H', datas:  ['hold 货舱1','hanker after 想吃（渴望）1','hold them off 阻击他们1','hide （动物的）毛皮1']},
      {alphabet: 'I', datas:  ['in reture 作为回应1']},
      {alphabet: 'J'},
      {alphabet: 'K'},
      {alphabet: 'L', datas:  ['launch a boat 放小船1']},
      {alphabet: 'M', datas:  ['misty 有雾的1','mutter 嘟哝1','make out 看出1','melt into 消失（在黑暗、人群等中）2']},
      {alphabet: 'N', datas:  ['navigate 辨别方向1']},
      {alphabet: 'O', datas:  ['odd 不成对的1','overcast 阴暗1','overcome 克服1']},
      {alphabet: 'P', datas:  ['provision 食品1','pitch my tent 搭帐篷1','plunge into 投入1','provided 只要1','promise 预示1','pound 砰砰跳1','plead 恳求1']},
      {alphabet: 'Q'},
      {alphabet: 'R', datas:  ['raging 波涛汹涌的1','rise （风力）增强1']},
      {alphabet: 'S', datas:  ['spear 矛1','suger cane 甘蔗1','sprout 发芽1','strain my ears 聚精会神地听1','sprint 快速奔跑1','signal 示意1','strand 搁浅1','spare 饶1','swarm 蜂拥1','speak our minds freely 彼此畅所欲言2','summon the spirits 招来鬼神2','see to it 留意，处理2','slump into 陷入2']},
      {alphabet: 'T', datas:  ['triumph 胜利1','thoughts rage like a storm 种种念头令他的脑海风起云涌2','take root in 生根2','think over 仔细考虑2']},
      {alphabet: 'U'},
      {alphabet: 'V', datas:  ['vanish from 突然不见']},
      {alphabet: 'W'},
      {alphabet: 'X'},
      {alphabet: 'Y', datas:  ['yield 投降1']},
      {alphabet: 'Z'},
    ],
    alpha: '',
    windowHeight: ''
  },
  onLoad(options){
    try {
      var res = wx.getSystemInfoSync()
      this.pixelRatio = res.pixelRatio;
      // this.apHeight = 32 / this.pixelRatio;
      // this.offsetTop = 160 / this.pixelRatio;
      this.apHeight = 16;
      this.offsetTop = 80;
      this.setData({windowHeight: res.windowHeight + 'px'})
    } catch (e) {
      
    }
  },
  handlerAlphaTap(e) {
    let {ap} = e.target.dataset;
    this.setData({alpha: ap});
  },
  handlerMove(e) {
    let {list} = this.data;
    let moveY = e.touches[0].clientY;
    let rY = moveY - this.offsetTop;
    if(rY >= 0) {
      let index = Math.ceil((rY - this.apHeight)/ this.apHeight);
      if(0 <= index < list.length) {
        let nonwAp = list[index];
        nonwAp && this.setData({alpha: nonwAp.alphabet});
      } 
    }
  }
})